/*
 * @Author: WangLi
 * @Date: 2021-07-21 09:38:35
 * @LastEditors: WangLi
 * @LastEditTime: 2021-08-17 13:58:35
 * @Description:
 */
import { md5 } from "./md5";

function random(min, max) {
  return Math.floor(Math.random() * (max - min)) + min;
}

export function createSign(appkey, secretKey) {
  const nonce = random(0, 100);
  const occurTime = Date.now();
  const jiam = secretKey + nonce + occurTime;
  const sign = md5(jiam).toLowerCase();
  return {
    appkey,
    nonce: nonce + "",
    occurTime: occurTime + "",
    sign,
  };
}
